package com.mingqijia.gassafety.shared.constant;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.HashMap;
import java.util.Map;

/**
 * 功能区、商圈、客户、本部
 */
@Getter
@RequiredArgsConstructor
public enum OrgDepartmentEnum {

    CUST_TYPE_1("1", "功能区"),
    CUST_TYPE_2("2", "商圈"),
    CUST_TYPE_3("3", "客户"),
    CUST_TYPE_4("4", "本部");

    private final String custTypeCode;
    private final String custType;

    /**
     * @Method getCustType
     * @Author zm
     * @Description getCustType
     * @Date 2024/8/15 14:57
     */
    public static String getCustType(String custType) {
        if (custType == null) {
            return null;
        }
        for (OrgDepartmentEnum typeEnum : OrgDepartmentEnum.values()) {
            if (typeEnum.custTypeCode.equals(custType)) {
                return typeEnum.custType;
            }
        }
        return "";
    }
    /**
     * @Method toMap
     * @Author zm
     * @Description toMap
     * @Date 2024/8/15 14:54
     */
    public static Map<String, String> toMap() {
        Map<String, String> map = new HashMap<>();
        for (OrgDepartmentEnum typeEnum : OrgDepartmentEnum.values()) {
            map.put(typeEnum.getCustTypeCode(), typeEnum.getCustType());
        }
        return map;
    }
}